home *** CD-ROM | disk | FTP | other *** search
- %OP%VS4.13 (28-Apr-92), Gerald L Fitton, R4000 5966 9904 9938
- %OP%DP0
- %OP%IRY
- %OP%PL0
- %OP%HM0
- %OP%FM0
- %OP%BM0
- %OP%LM4
- %OP%PT1
- %OP%PDPipeLine
- %OP%WC1026,2262,188,1748,0,0,0,0
- %CO:A,72,72%
- %C%Nested Ifs and Lookup tables
- %C%by Gerald L Fitton
- Keywords:
- NestedIf Lookup Custom Fitton
-
- This short application arose from some correspondence about testing
- multiple conditions with Ian Masterton. His interest is to return
- values such as "White" or "Red" (wine) when the input is such words as
- "Claret" or "Medoc".
-
- The first technique is that of nested ifs as illustrated by the file
- [IfItIs]. It is suitable only when the number of conditions is small.
- When the application would lead to many complicated 'nested ifs' then a
- better approach is to use a custom function containing a lookup list.
-
- Such an approach was explained in the directory Custom03 on the
- AugustĀ 1992 PipeLineĀ 4 disc and it is illustrated by [WineCellar] and
- its custom function [c_Wine]. To see this second method in operation
- double click on the file [WineCellar]. Both [WineCellar] and the
- custom function [c_Wine] will open. The custom function uses the
- lookup functions and lookup tables within it. The result is returned
- to slots in [WineCellar].
-
- Note the ^# at the end of each lookup table. The ^# matches anything
- which is not found in the lookup table and returns an 'error message'
- to the slot from which the custom function is called.
-